package cn.edu.hust.sse.software7.class3.serviceImpl;

import java.util.List;
import java.util.logging.Logger;

import cn.edu.hust.sse.software7.class3.DAO.EBCommonOnProductDAO;
import cn.edu.hust.sse.software7.class3.entities.EBCommonOnProduct;
import cn.edu.hust.sse.software7.class3.service.EBCommonOnProductService;

public class EBCommonOnProductServiceImpl implements EBCommonOnProductService {
	EBCommonOnProductDAO dao = new EBCommonOnProductDAO();
	
	public EBCommonOnProductServiceImpl() {
		if (dao == null) {
			dao = new EBCommonOnProductDAO();
		}
		Logger.getLogger(EBCommonOnProductServiceImpl.class.getName());
	}

	@Override
	public void addCommon(EBCommonOnProduct common) {
		dao.addCommon(common);
	}

	@Override
	public List<EBCommonOnProduct> getCommonsByProductId(Long prodId) {
		return dao.getCommonsByProductId(prodId);
	}

	@Override
	public List<EBCommonOnProduct> getCommonsByProdUser(Long prodId, Long userId) {
		return dao.getCommonsByProdUser(prodId, userId);
	}

	@Override
	public void deleteCommonsByProd(Long prodId) {
		dao.deleteCommonsByProd(prodId);
	}

	@Override
	public void deleteCommonsByUser(Long userId) {
		dao.deleteCommonsByUser(userId);		
	}

}
